/* 
 * ProductPolisher.java
 * Copyright (c) 2008 WayfarerX.net and others (see below).
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 * Contributors:
 *   WayfarerX (2008) - Initial documentation & implementation.
 * 
 */
package net.wayfarerx.tools.export.internal;

import java.io.File;

import org.eclipse.core.runtime.IProgressMonitor;

/**
 * Base class for platform-specific additions to the default export behavior.
 * 
 * @author WayfarerX
 */
abstract class ProductPolisher {
	/**
	 * Creates and returns a platform-specific polisher.
	 * 
	 * @return A new platform-specific polisher or {@code null} if no polisher
	 *         exists for the current platform.
	 */
	static ProductPolisher newInstance() {
		String platform = Activator.getSystemProperty("osgi.os"); //$NON-NLS-1$
		if ("macosx".equalsIgnoreCase(platform)) //$NON-NLS-1$
			return new MacosxPolisher();
		return null;
	}

	/**
	 * Polishes the exported product in the specified root directory.
	 * 
	 * @param monitor The progress monitor to use.
	 * @param rootDirectory The root directory the product was exported to.
	 * @throws Exception If the polish procedure fails.
	 */
	abstract void polish(IProgressMonitor monitor, File rootDirectory)
	    throws Exception;
}
